package gui_interface;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.regex.Pattern;

public class Config {
	
	//variables corresponding to genetic algorithm
		public int number_of_mutations_per_evolution_process;
		public int number_of_tests_per_mutation;
		
		//variables corresponding to environment
		public int size_environment;
		public int x_init;
		public int y_init; 
		
		
		//maximal number of nodes added to the network
		public int maximal_number_of_nodes;
		// number of nodes at snapshots
		public LinkedList<Integer> snapshotsTimes = new LinkedList<Integer>();
		
		
		public Config(String config){
			BufferedReader br;
			try {
				br = new BufferedReader( new FileReader(new File(config)));
				
				br.readLine();
				size_environment = Integer.parseInt( br.readLine());
				
				br.readLine();
				x_init = Integer.parseInt( br.readLine());
				
				br.readLine();
				y_init = Integer.parseInt( br.readLine());
				
				br.readLine();
				maximal_number_of_nodes = Integer.parseInt( br.readLine());
				
				br.readLine();
				Pattern p= Pattern.compile(" ");
				String[] result = p.split(br.readLine());
				for (String s : result){
					snapshotsTimes.addLast(Integer.parseInt(s));
				}
				
				
				br.readLine();
				number_of_mutations_per_evolution_process = Integer.parseInt( br.readLine());
				
				br.readLine();
				number_of_tests_per_mutation = Integer.parseInt( br.readLine());
				br.close();
				
			} catch (FileNotFoundException e) {
				System.out.println("config file not found");
				e.printStackTrace();
			} catch (IOException e) {
				System.out.println("incorrect config file");
				e.printStackTrace();
			}
			
			
			 
			 
			 
			
			
		}
	
}
